import 'dart:async';

import 'package:check_app/api/request.dart';
import 'package:check_app/model/http_model.dart';
import 'package:check_app/model/userInfo.dart';

const PASSWORD_PATH = '/admin/edit/password';
const SAVE_PATH = '/admin/edit/appMyInfo';
const CERT_PATH = '/admin/edit/certificate';

///首页接口
class UserInfoDao {
  static Future fetch(path, params) async {
    final response = await Request().get(path, queryParameters: params);
    return UserInfoResult.fromJson(response);
  }

  static Future savePassword(params) async {
    final response =
        await Request().post(PASSWORD_PATH, queryParameters: params);
    return HttpModelResult.fromJson(response);
  }

  static Future save(params) async {
    final response = await Request().post(SAVE_PATH, queryParameters: params);
    return HttpModelResult.fromJson(response);
  }

  static Future saveCert(params) async {
    final response = await Request().post(CERT_PATH, queryParameters: params);
    return HttpModelResult.fromJson(response);
  }
}
